//index.js
const app = getApp()
const { envList } = require('../../envList.js')

Page({
  data: {
    envId: '',
    record: ''
  },

  onLoad(options) {
    this.setData({
      envId: options.envId
    })
  },
  clickPlayVideo(id){
    console.log("看视频", id)
    wx.navigateTo({
      url: '/pages/videoPlay/index'
    })
  },
  getRecord() {
    wx.showLoading({
      title: '',
    })
   wx.cloud.callFunction({
      name: 'quickstartFunctions',
      config: {
        env: this.data.envId
      },
      data: {
        type: 'selectRecord'
      }
    }).then((resp) => {
      console.log(resp);
      this.setData({
        haveGetRecord: true,
        record: resp.result.data
      })
     wx.hideLoading()
   }).catch((e) => {
      console.log(e)
      this.setData({
        showUploadTip: true
      })
     wx.hideLoading()
   })
  },
  onReady() {
    this.getRecord();
    this.videoContext = wx.createVideoContext('myVideo');
  }
})

